Skip to content

Conversation

@maxisbey
Copy link
Contributor

Add strict-no-cover from pydantic to the CI pipeline. This tool identifies # pragma: no cover comments on lines that are actually covered by tests, helping keep coverage pragmas accurate.

Changes

  • Add strict-no-cover as dev dependency (installed from git)
  • Add pragma: lax no cover to coverage exclude_lines for partial coverage scenarios
  • Add CI step to run strict-no-cover after coverage report (skips Python 3.14 since the package doesn't support it yet)

How it works

  • # pragma: no cover - errors if any marked lines are actually covered
  • # pragma: lax no cover - permits partial coverage without erroring (useful for flaky or inconsistently covered code)

@maxisbey maxisbey force-pushed the add-strict-no-cover branch from 6f96e17 to 78d6633 Compare January 16, 2026 14:47
Add strict-no-cover from pydantic to CI pipeline. This tool identifies
`# pragma: no cover` comments on lines that are actually covered by
tests, helping keep coverage pragmas accurate.

Changes:
- Add strict-no-cover as dev dependency (installed from git)
- Add `pragma: lax no cover` to coverage exclude_lines for partial coverage
- Add CI step to run strict-no-cover after coverage report (Linux only due to Windows bug in the tool)
@maxisbey maxisbey force-pushed the add-strict-no-cover branch from 78d6633 to edefce3 Compare January 17, 2026 09:37
@maxisbey maxisbey requested a review from Kludex January 17, 2026 09:37
uv run --frozen --no-sync coverage report
- name: Check for unnecessary no cover pragmas
if: runner.os != 'Windows'
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kludex without this all the windows pipelines fail to even run, seems like a strict-no-cover bug? Example failure from previous CI run: https://github.com/modelcontextprotocol/python-sdk/actions/runs/21070443439/job/60598385217

@Kludex
Copy link
Member

Kludex commented Jan 17, 2026

Is this working already? All the pragmas are actually being used?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants